#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
int Q[1005][1005];
int K[1005][1005];
int V[1005][1005];
int W[1005];

void multiplyMatrices(int A[MAXN][MAXN], int B[MAXN][MAXN], int C[MAXN][MAXN],
                      int rowsA, int colsA, int colsB) {
  for (int i = 1; i <= rowsA; i++)
    for (int j = 1; j <= colsB; j++) {
      C[i][j] = 0;
      for (int k = 1; k <= colsA; k++)
        C[i][j] += A[i][k] * B[k][j];
    }
}

// 矩阵转置
void transposeMatrix(int A[MAXN][MAXN], int rows, int cols) {
  int B[MAXN][MAXN];

  for (int i = 1; i <= rows; i++)
    for (int j = 1; j <= cols; j++)
      B[j][i] = A[i][j];

  memcpy(A, B, sizeof(A));
}

int main() {
  int n, d;
  cin >> n >> d;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= d; j++)
      cin >> Q[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= d; j++)
      cin >> K[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= d; j++)
      cin >> V[i][j];
  for (int i = 1; i <= n; i++)
    cin >> W[i];

  return 0;
}